{include file='Public/header' /}
<div class="layui-layout layui-layout-admin">
{include file='Public/head' /}	
{include file='Public/side' /}	
	<div class="layui-body"> 
{include file='Public/crumbs' /}
		<!-- 内容主体区域 -->
		<div class="shu-body shu-setting">
			<div class="layui-fluid">
				<form class="layui-form layui-form-pane" action="" method="post">
				<div class="layui-form-item" style="display:none;">
				  	<label class="layui-form-label">网站名称</label>
				  	<div class="layui-input-inline">
					<input type="text" name="sitename" id="sitename" value="{$Think.CONFIG.sitename}" required lay-verify="required" autocomplete="off" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux">前台调用：{<literal>$Think.CONFIG.sitename</literal>}</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">网站标题</label>
				  	<div class="layui-input-inline">
					<input type="text" name="title" id="title" value="{$Think.CONFIG.title}" required lay-verify="required" autocomplete="off" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux">前台调用：{<literal>$Think.CONFIG.title</literal>}</div>
				</div>
				<div class="layui-form-item">
				  	<label class="layui-form-label">关键词</label>
				  	<div class="layui-input-inline">
					<input type="text" name="keywords" id="keywords" value="{$Think.CONFIG.keywords}" class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux">网站关键词，前台调用：{<literal>$Think.CONFIG.keywords</literal>}</div>
				</div>
				<div class="layui-form-item layui-form-text">
				  	<label class="layui-form-label">网站描述</label>
				  	<div class="layui-input-block">
					<textarea name="description" placeholder="网站描述" class="layui-textarea">{$Think.CONFIG.description}</textarea>
				  	</div>
					<div class="layui-form-mid layui-word-aux">网站描述，前台调用：{<literal>$Think.CONFIG.description</literal>}</div>
				</div>
				<div class="layui-form-item layui-form-text">
				  	<label class="layui-form-label">底部内容</label>
				  	<div class="layui-input-block">
					<textarea id="textarea" name="footer" placeholder="底部内容" class="layui-textarea" style="height:300px;">{$Think.CONFIG.footer}</textarea>
				  	</div>
					<div class="layui-form-mid layui-word-aux">网站的版权、统计代码等，支持HTML代码，请谨慎使用，前台调用：{<literal>$Think.CONFIG.footer</literal>}</div>
				</div>
				{volist name="vars" id="val"}
				<div class="layui-form-item">
				  	<label class="layui-form-label">{$val.name}</label>
				  	<div class="layui-input-inline">
					<input type="text" name="{$val.k}" id="{$val.k}" placeholder="变量值" value="{$val.v}"  class="layui-input">
				  	</div>
					<div class="layui-form-mid layui-word-aux">自定义变量，前台调用：<literal>{$Think.CONFIG.</literal>{$val.k}<literal>}</literal></div>
				</div>
				{/volist}
				<div class="layui-form-item">
				  <div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				  </div>
				</div>
			  </form>
			</div>
		</div>
		<!-- 内容主体区域 END-->
	</div>
{include file='Public/footer' /}	
<script>
layui.use(['form','layer'], function(){
	var form = layui.form,jq = layui.$,layer=layui.layer;
	form.on('submit(formDemo)', function(data){
		loading = layer.load(2, {
			shade: [0.2,'#000']
		});
		var param = data.field;
		jq.post("{:url('update')}",param,function(data){
			//console.log(data);
			if(data.code == 200){
				layer.close(loading);
				layer.msg(data.msg, {icon: 1, time: 1000}, function(){
					location.reload();
					//location.href="{:url('index')}";
				});
			}else{
				layer.close(loading);
				layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
			}
		});
	return false;
	});
	
	////编辑器
	var editor = new wangEditor('textarea');
	editor.config.uploadImgUrl = "{:url('Upload/picupdate')}";
	editor.config.uploadImgFileName = 'FileName';
	editor.config.menus = $.map(wangEditor.config.menus, function(item, key) {
//	if (item === 'img') {  //屏蔽图片
//	return null;
//	}
	if (item === 'eraser') {
	return null;
	}
	if (item === 'video') {
	return null;
	}
	if (item === 'location') {
	return null;
	}
	return item;
	});
	editor.config.pasteText = true;
	editor.create();
	
	
	
});
</script>